﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
    public static class BllCommon
    {
        // <summary>
        /// 根据某一天，返回该日期所处月的第一天
        /// </summary>
        /// <param name="datePoint"></param>
        /// <returns></returns>
        public static DateTime GetMonthFirstDay(DateTime datePoint)
        {
            DateTime FirstDay = datePoint.AddDays(-datePoint.Day + 1);
            return FirstDay;
        }

        /// <summary>
        /// 根据某一天，返回该日期所处月的最后一天
        /// </summary>
        /// <param name="datePoint"></param>
        /// <returns></returns>
        public static DateTime GetMonthLastDay(DateTime datePoint)
        {
            DateTime LastDay = datePoint.AddMonths(1).AddDays(-datePoint.AddMonths(1).Day);
            return LastDay;
        }
    }
}
